<template>
    <div class="about_wraper">
        <!-- 导航条 -->
        <Nav />

        <div class="banner_wrap"
            v-if="banners&&banners.length>0"
            :style="{'background': 'url('+$baseImageUrl+banners[0].url+')', 'background-repeat': 'no-repeat', 'background-size': '100% 100%'}">
        </div>

        <div class="detail_wrap">
            <div class="header_wrap">
                <div class="header">
                    <div class="header_title" v-if="detail">{{ detail.title }}</div>
                    <div class="date" v-if="detail">{{ detail.pushDate | formatDate }}</div>
                </div>
            </div>

            <div class="news_items_wrap">
                <div class="container" v-if="detail">
                    <div v-if="detail" v-html="detail.content"></div>
                </div>

            </div>
        </div>

        <!-- 底部footer -->
        <Footer />

    </div>
</template>
<script>
import Nav from '@/views/nav/index'
import Footer from '@/views/footer/index'
import p1 from '@/assets/images/wi/21.png'
import { formatDate, parseTime } from '@/libs/filters'
import { getStore } from '@/libs'
export default {
    name: "index",
    components: {
        Nav,
        Footer,
    },
    data() {
        return {
            p1,
            params: null,
            detail: null

        }
    },



    created() {
        this.params = this.$route.query
        this.getBanner()
        this.getInfo()
    },
    methods: {
        /**
         * 获取Banner
         */
         async getBanner() {
            let terminal = 1
            let country = 1

            // 切换语言
            if(getStore({name: 'language'}) === 'jp') {
                country = 2
            }
            const res = await this.$http({
                url: '/api/siteswiper/list',
                method: 'GET',
                params: {cate: 9, terminal, country}
            })
            if (this.ResultMessage(res, false)) {
                if(res.data) {
                    this.banners = res.data
                }
            }
        },
        /**
         * 详细信息
         */
         async getInfo() {
            let terminal = 2
            let country = 1

            // 切换语言
            if(getStore({name: 'language'}) === 'jp') {
                country = 2
            }
            const res = await this.$http({
                url: '/api/sitepagelist/info',
                method: 'GET',
                params: {id: this.params.id, country}
            })
            this.detail = Object.assign({}, res.data)
        },
    },
    filters: {
        formatDate(value) {
            if (value) {
                return formatDate(new Date(value), 'yyyy-MM-dd');
            } else {
                return '-';
            }
        }
    }
};
</script>


<style lang="scss" scope>
.about_wraper{
    background-color: #F8F9F9;

    .banner_wrap{
        position: relative;
        width: 100%;
        height: 400px;
        background-image: url('../../assets/images/wi/about.png');
        background-size: 100% 100%;
        background-repeat: no-repeat;
        display: flex;
        align-items: center;
        justify-content: center;

    }
    .detail_wrap{
        display: flex;
        justify-content: center;
        flex-direction: column;
        align-items: center;

        .header_wrap{
            // width: 1080px;
            width: 100%;
            .header{

                display: flex;
                justify-content: center;
                align-items: center;
                flex-direction: column;
                margin-top: 40px;
                border-bottom: 1px solid #eee;
                padding: 10px;
                .header_title{
                    text-align: center;
                    font-size: 28px;
                    font-weight: bold;
                    color: #333;
                }
                .date{
                    color: #999;
                    display: flex;
                    margin-top: 10px;
                }
            }
        }

        .news_items_wrap{
            width: 100%;
            margin: 20px 0 50px 0;
            display: flex;
            flex-direction: column;
            justify-content: center;

            .container{
                padding: 20px;
                overflow: hidden;
            }
        }
    }

}

</style>
